<!-- 单独购买某个物品，结算页面 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="gbk">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>购买</title>
    <link href="/static/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <link href="/static/css/container.css" rel="stylesheet">
</head>
<body>
    <!-- 头部 -->
    <header onClick="toHome()">
        <div class="navbar navbar-dark bg-dark shadow-sm">
          <div class="container">
            <a href="#" class="navbar-brand d-flex align-items-center">
              <strong>结算单个商品</strong>
            </a>
          </div>
        </div>
      </header>
      <!-- 主体部分 -->
      <main>
        <div class="album py-5 bg-light">
            <div class="container page-container">
                <div class="card shadow-sm" style="width:40%;">
                    <img src="{{ cur_good['img'] }}" class="bd-placeholder-img card-img-top" width="100%" height="300">
                    <div class="card-body">
                    <p class="card-text">{{ cur_good['name'] }}</p>
                    <div class="d-flex justify-content-between align-items-center">
                        <small class="text-muted">￥{{ cur_good['price'] }}</small>
                    </div>
                    </div>
                </div>
            </div>
        </div>
        <div style="float:right;position:fixed;bottom:20px;right:20px;">
            <button class="btn btn-primary" onClick="shop()">
                结算
            </button>
        </div>
      </main>
      <script>
        // 结算，路径携带当前物品id，用于服务端计算费用
        function shop() {
          _id = window.location.search.substring(1).split('=')[1]
          window.location.href = 'buy_single?_id=' + _id
        }
        // 回到首页
        function toHome(){
          window.location.href = '/'
        }
      </script>
</body>
</html>